home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World's Largest Collection of Windows Software
/
The World's Largest Collection of Windows Software - Disc 2.iso
/
textproc
/
tlcspell
/
spellm1.ba_
/
spellm1.ba
Wrap
Text File
|
1993-12-02
|
7KB
|
201 lines
Option Explicit
DefInt A-Z
Global Const HELP_CONTEXT = &H1 'Display topic in ulTopic
Global Const HELP_QUIT = &H2 'Terminate help
Global Const HELP_INDEX = &H3 'Display index
Global Const HELP_CONTENTS = &H3
Global Const HELP_HELPONHELP = &H4 'Display help on using help
Global Const HELP_SETINDEX = &H5 'Set the current Index for multi index help
Global Const HELP_SETCONTENTS = &H5
Global Const HELP_CONTEXTPOPUP = &H8
Global Const HELP_FORCEFILE = &H9
Global Const HELP_KEY = &H101 'Display topic for keyword in offabData
Global Const HELP_COMMAND = &H102
Global Const HELP_PARTIALKEY = &H105 'call the search engine in winhelp
' MsgBox parameters
Global Const MB_OK = 0 ' OK button only
Global Const MB_OKCANCEL = 1 ' OK and Cancel buttons
Global Const MB_ABORTRETRYIGNORE = 2 ' Abort, Retry, and Ignore buttons
Global Const MB_YESNOCANCEL = 3 ' Yes, No, and Cancel buttons
Global Const MB_YESNO = 4 ' Yes and No buttons
Global Const MB_RETRYCANCEL = 5 ' Retry and Cancel buttons
Global Const MB_ICONSTOP = 16 ' Critical message
Global Const MB_ICONQUESTION = 32 ' Warning query
Global Const MB_ICONEXCLAMATION = 48 ' Warning message
Global Const MB_ICONINFORMATION = 64 ' Information message
' MsgBox return values
Global Const IDOK = 1 ' OK button pressed
Global Const IDCANCEL = 2 ' Cancel button pressed
Global Const IDYES = 6 ' Yes button pressed
Global Const IDNO = 7 ' No button pressed
Global Const OFN_OVERWRITEPROMPT = &H2&
Global Const OFN_PATHMUSTEXIST = &H800&
Global Const OFN_FileMustExist = &H1000&
'
'Declare Function SetPPStr Lib "kernel" Alias "WritePrivateProfileString" (ByVal s$, ByVal i$, ByVal V$, ByVal P$)
'Declare Function GetPPInt Lib "Kernel" Alias "GetPrivateProfileInt" (ByVal s$, ByVal E$, ByVal i, ByVal F$)
'Declare Function GetPPStr Lib "Kernel" Alias "GetPrivateProfileString" (ByVal Sect$, ByVal Ent$, ByVal Def$, ByVal Ret$, ByVal Lenth, ByVal File$)
'Declare Function WinDir Lib "Kernel" Alias "GetWindowsDirectory" (ByVal B$, ByVal nSize)
'Declare Function GetPStr Lib "Kernel" Alias "GetProfileString" (ByVal Sect$, ByVal Ent$, ByVal Def$, ByVal Ret$, ByVal Lenth)
'Declare Function GetFocus Lib "User" ()
'Declare Function GetSystemMetrics Lib "User" (ByVal nIndex As Integer) As Integer
'Declare Function GetTickCount Lib "User" () As Long
Declare Function WFind Lib "TlcDic.dll" (ByVal AWord$, ByVal Add, ByVal Filename$)
Declare Function DelWord Lib "TlcDic.dll" (ByVal AWord$, ByVal Filename$)
Declare Function ReadDic Lib "TLCDic.DLL" (ByVal fn$, ByVal stem$, ByVal hListBox)
Global LexPath As String
Global spage As Long
Global LastCk As Integer
Global part As String
Global WordStart As Integer
Global WordEnd As Integer
Global DataFile As String
Function ChkWord ()
Dim i As Integer, k As Integer
Dim Done As Integer
i = LastCk + 1
ChkWord = 0
' Find first alpha character
While i < spage And Not Done
If UCase(Mid(FrmDoc!Text1, i, 1)) < "A" Or UCase(Mid(FrmDoc!Text1, i, 1)) > "Z" Then
i = i + 1
Else
Done = True
End If
Wend
If i = spage Then
MsgBox "Speller has reach the end of this page."
Unload FrmChk
Exit Function
End If
Done = False
WordStart = i
' Find first non alpha character
While i < spage And Not Done
If UCase(Mid(FrmDoc!Text1, i, 1)) < "A" Or UCase(Mid(FrmDoc!Text1, i, 1)) > "Z" Then
Done = True
Else
i = i + 1
End If
Wend
If i = spage Then
MsgBox "Speller has reach the end of this page."
Unload FrmChk
Exit Function
End If
Done = False
WordEnd = i
LastCk = i - 1
If FrmChk!CkHilight = 1 Then
FrmDoc!Text1.SelStart = WordStart - 1
FrmDoc!Text1.SelLength = WordEnd - WordStart + 1
End If
ChkWord = TestWord(LCase(Mid(FrmDoc!Text1, WordStart, WordEnd - WordStart)))
End Function
Function GetFileName (Act As Integer, NewFile As String)
Dim i As Integer
GetFileName = 0
FrmAbout!CmnDialog.Flags = OFN_OVERWRITEPROMPT + OFN_PATHMUSTEXIST
FrmAbout!CmnDialog.Filename = "*.Txt"
FrmAbout!CmnDialog.Filter = "Text |*.Txt | Logs |*.Log |All |*.*"
FrmAbout!CmnDialog.FilterIndex = 0
FrmAbout!CmnDialog.CancelError = True
If Act = 1 Then
FrmAbout!CmnDialog.DialogTitle = "Read File"
FrmAbout!CmnDialog.Flags = FrmAbout!CmnDialog.Flags + OFN_FileMustExist
Else
FrmAbout!CmnDialog.DialogTitle = "Save File As"
End If
FrmAbout!CmnDialog.InitDir = Mid$(LexPath, 1, Len(LexPath) - 1)
On Error Resume Next
FrmAbout!CmnDialog.Action = Act
If Err Then
On Error GoTo 0
Exit Function
End If
NewFile = FrmAbout!CmnDialog.Filename
GetFileName = 1
End Function
Sub Main ()
LexPath = App.Path + "\"
App.HelpFile = LexPath + "TLCSpell.Hlp"
FrmDoc.Show
End Sub
Sub ReadFile (Filename As String)
Dim fn As Integer, fsiz As Long, rsiz As Integer
fn = FreeFile
On Error GoTo ReadFileErr1
Open Filename For Binary As #fn
fsiz = FileLen(Filename)
If fsiz - spage > 20000 Then
rsiz = 20000
Else
rsiz = fsiz
End If
part = Space(rsiz)
Get #fn, spage, part
Close
spage = spage + rsiz
FrmDoc!Text1 = Trim(part)
part = ""
Exit Sub
ReadFileErr1:
MsgBox Error
Close
Resume ReadFileQuit
ReadFileQuit:
End Sub
Sub SetParams ()
Dim IniPath As String
Dim i As Integer
' IniPath = "WordGame.ini"
' Skill = GetPPInt("GameOptions", "Skill", 0, IniPath)
' Flags = GetPPInt("GameOptions", "Rule", 6, IniPath)
' GFontSize = GetPPInt("GameOptions", "FontSize", 12, IniPath)
' HandSize = GetPPInt("GameOptions", "HandSize", 5, IniPath)
' TimeLimit = GetPPInt("GameOptions", "TimeLimit", 0, IniPath)
' BoardSize = GetPPInt("GameOptions", "BoardSize", 12, IniPath)
End Sub
Function TestWord (Word As String)
Dim i As Integer, hListBox
Dim Addit As Integer
Addit = False
i = WFind(Word, Addit, LexPath + "English.Lex")
If i = 0 Then
FrmChk!LblHis.Caption = Word
FrmChk!TxtNew = Word
If FrmChk!CkSuggest = 1 Then
hListBox = FrmChk!LstSuggest.hWnd
i = ReadDic(LexPath + "English.Lex", Mid(Word, 1, 3), hListBox)
If (i) Then
FrmChk!TxtNew = FrmChk!LstSuggest.List(0)
End If
End If
TestWord = 0
Else
TestWord = -1
End If
End Function